package com.gdougms.tools;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Random;

@Component
public class RandomCode {


    /**@Title
     * @Description 生成四位数字验证码
     * @Param []
     * @return java.lang.String
     * @Author iceF
     * @Date 2021/6/20
    */
    public static String creatCode(){
        Random random = new Random();
        String str = "";
        for (int i = 0; i < 4; i++) {
            str += random.nextInt(10);
        }
        return str;
    }
}
